// app.js
import { request } from "request/index.js"
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    this.getBridgeDate()
     this.getMaskData()
    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    userInfo: null,
    dealList:[],           //筛选处理后的数据集合
    bridgeList:[],              //请求到的数据综合           
    maskDataList:[]          //请求到的标段数据
  },
  getBridgeDate(){
    request({
      url:'action3/YHBridgeManage-BridgeInfo-YHBridgeInfoQueryByBridgeId',
      data:{                      
        bridgeid:''
      },
      method:'POST'
    })
    .then(res=>{
      console.log(res)
      this.globalData.bridgeList=res.data.bridgeResult
      console.log(this.globalData.bridgeList)
      if(this.globalData.bridgeList==null||this.globalData.bridgeList.length==0){
        wx.showToast({
          title:'数据请求出错'
        })
      }    
    })
  },
  getMaskData:function(){
    request({
      url:'action2/ManageSection-ManageSectionQuery',
      method:'POST'
    })
    .then(res=>{
      console.log(res)
      this.globalData.maskDataList=res.data.sectionResult
     console.log(this.globalData.maskDataList)
    })
  },
})
